feat: implement configurable memory limit for shell executor jobs#1798
Merged
feat: implement configurable memory limit for shell executor jobs#1798
Conversation
- Add mem_limit parameter validation to job.go - Implement memory monitoring and enforcement in shell executor - Add comprehensive tests for memory limit parsing and validation - Update documentation with memory limit usage examples - Support various memory units (B, KB, MB, GB, TB) - Integrate memory monitoring with existing process metrics collection Co-authored-by: vcastellm <47026+vcastellm@users.noreply.github.com>
Co-authored-by: vcastellm <47026+vcastellm@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Check the PR @distribworks/dkron/pull/758 to check if the things included in the PR are already implemented in the project, and if not, start implementing the first task: configurable timeout for job execution
Implement configurable memory limit for shell executor jobs
Sep 9, 2025
Member
|
@copilot merge master |
Copilot stopped work on behalf of
vcastellm due to an error
December 11, 2025 21:28
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1798 +/- ##
==========================================
+ Coverage 31.64% 31.66% +0.01%
==========================================
Files 76 76
Lines 6819 6933 +114
==========================================
+ Hits 2158 2195 +37
- Misses 4364 4435 +71
- Partials 297 303 +6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR implements configurable memory limits for shell executor jobs, completing the resource management capabilities that were partially introduced in PR #758.
Problem
While analyzing PR #758, I discovered that Dkron already has comprehensive timeout functionality and Prometheus metrics, but was missing the memory limit enforcement feature. This left a gap in resource management where jobs could consume excessive memory without any built-in protection mechanism.
Solution
Added a new
mem_limitparameter to the shell executor that provides:"512MB","1GB","1024"(bytes),"1.5GB", etc.Implementation Details
Job Validation (
dkron/job.go)Shell Executor Enhancement (
plugin/shell/shell.go)The implementation integrates seamlessly with existing process monitoring:
Documentation Updates
Added comprehensive documentation including:
mem_limitdescriptionUsage Examples
Basic memory limit:
{ "executor": "shell", "executor_config": { "command": "/opt/scripts/data_processing.sh", "mem_limit": "512MB" } }Combined resource limits:
{ "executor": "shell", "executor_config": { "command": "/opt/scripts/intensive_task.sh", "timeout": "30m", "mem_limit": "1GB" } }Testing
Benefits
This implementation completes the resource management story for Dkron shell jobs, providing administrators with both time-based (
timeout) and memory-based (mem_limit) controls to ensure reliable job execution within defined resource boundaries.💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.